package com.liu.dao;

import cn.oa.dao.EmployeeDao;
import cn.oa.entity.Employee;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;

public class adfgthywje {
    @Test
    public void dsa(){
        SqlSession sqlSession=null;
        try{
            String oo="mybatis-config.xml";
            InputStream is= Resources.getResourceAsStream(oo);
            SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(is);
            sqlSession= sqlSessionFactory.openSession();
            EmployeeDao employeeDao=sqlSession.getMapper(EmployeeDao.class);
            Employee employee= employeeDao.findEmployee("1000890901","123456");
            System.out.println(employee);
            sqlSession.close();
        } catch (IOException | SQLException e) {
            e.printStackTrace();
        }
    }
}
